package com.stormragetech.arthas.demo.httpserver.app;

import com.stormragetech.arthas.server.HttpServer;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;

/**
 * description: //TODO
 *
 * @author: Xue Bin
 * @version: 1.0.0-SNAPSHOT
 */
@Log4j2
public class Launch {

    private static final String conf = "arthas.xml";

    public static void main(String[] args) throws Exception {

        log.info("arthas netty http server demo is loading ...");
        log.info(" ");
        log.info("--------------------------------------------------");
        log.info("--------------------------------------------------");
        log.info("--------------------------------------------------");

        // start spring service
        //
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        context.start();

        log.info("spring loading complete !!!");
        log.info("--------------------------------------------------");

        //start netty service
        //
        new HttpServer(conf, context).run();

        log.info("arthas netty http server demo started !!!");

        try {
            System.in.read();   // 按任意键退出
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
